<?php

namespace Admin\Controller;

class QuestionController extends AdminController {

	//类型 易错题
    public function typelist(){
		$data['list'] = M('question_type')->select();
		$this->assign($data);
		$this->display('typelist');
    }
	public function typeadd(){
		$a = M('question_type')->data(I('post.'))->add();
		if($a){
			$this->success('新增成功', 'typelist');
		}
	}
	public function typedel(){
		$a = M('question_type')->data(I('post.'))->delete();
		if($a){
			$this->ajaxReturn(1);
		}else{
			$this->ajaxReturn(2);
		}
	}

	//分类 选择题
	public function classifylist(){
		$data['list'] = M('question_classify')->select();
		$this->assign($data);
		$this->display('classifylist');
	}

	public function classifyadd(){
		$a = M('question_classify')->data(I('post.'))->add();
		if($a){
			$this->success('新增成功', 'classifylist');
		}
	}
	public function classifydel(){
		$a = M('question_classify')->data(I('post.'))->delete();
		if($a){
			$this->ajaxReturn(1);
		}else{
			$this->ajaxReturn(2);
		}
	}

	//年级管理 一年级 高一 必修一
	public function gradelist(){
		$data['list'] = M('question_grade')->select();
		$this->assign($data);
		$this->display('gradelist');
	}
	public function gradeadd(){
		$a = M('question_grade')->data(I('post.'))->add();
		if($a){
			$this->success('新增成功', 'gradelist');
		}
	}
	public function gradedel(){
		$a = M('question_grade')->data(I('post.'))->delete();
		if($a){
			$this->ajaxReturn(1);
		}else{
			$this->ajaxReturn(2);
		}
	}

	//学科 语文
	public function subjectlist(){
		$data['list'] = M('question_subject')->select();
		$this->assign($data);
		$this->display('subjectlist');
	}
	public function subjectadd(){
		$a = M('question_subject')->data(I('post.'))->add();
		if($a){
			$this->success('新增成功', 'subjectlist');
		}
	}
	public function subjectdel(){
		$a = M('question_subject')->data(I('post.'))->delete();
		if($a){
			$this->ajaxReturn(1);
		}else{
			$this->ajaxReturn(2);
		}
	}
	//question manage
	public function questionadd(){
		$this->display('questionadd');
	}

	public function questionlist(){

	}

	public function questionUpdate(){

	}


}